package com.durl.simple.house;

import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.SqlManager;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;

public class PostgresqlIniter extends DBIniter {

	public PostgresqlIniter(Dao dao, SqlManager sqlManager) {
		super(dao, sqlManager);
	}

	@Override
	void createTable() {
		Sql sql = sqlManager.create("postgresql_create");
		this.dao.execute(sql);
	}

	@Override
	boolean isTableExist() {
		Record record = dao.fetch("pg_tables", Cnd.format("tablename  ='shorturl'"));
		if (record != null)
			return true;
		return false;
	}

}
